package handlers

import (
	"github.com/gin-gonic/gin"
	"order-master/models"
	"strconv"
)

func Add(c *gin.Context) {
	per_code := c.PostForm("per_code")
	per_name := c.PostForm("per_name")
	per_num, _ := strconv.Atoi(c.PostForm("per_num"))

	data := models.Person{
		PerCode: per_code,
		PerName: per_name,
		PerNum:  per_num,
	}
	models.DB.Create(&data)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "ok",
	})
	return
}
